package itheima.com.Demo01.demo01.HasSet01;

import java.util.HashSet;

public class TestHash {
    public static void main(String[] args) {
        HashSet<Student> set = new HashSet<>();
        Student s1 = new Student("0",24);
        Student s2 = new Student("01",21);
        Student s3 = new Student("1",22);
        Student s4 = new Student("张三",24);
        set.add(s1);
        set.add(s2);
        set.add(s3);
        set.add(s4);
        System.out.println("通话".hashCode());
        System.out.println("重地".hashCode());






        for (Student student : set) {
            System.out.println(student);
        }

        System.out.println("0的"+s1.hashCode());
        System.out.println(s1.hashCode());
        System.out.println("-----------------");
        System.out.println("01的"+s2.hashCode());
        System.out.println(s2.hashCode());
        System.out.println("-----------------");
        System.out.println("1的"+s3.hashCode());
        System.out.println("-----------------");
        System.out.println(s4.hashCode());
//        24021583
//        24021583
//                -----------------
//                26103912
//        26103912
//                -----------------
//                29049037
//                        -----------------
//                23167254

    }
}
